package views.panes;

import views.screens.Screen;

public class ButtonUserNoVote extends javax.swing.JPanel {

    String user="";
    Screen screen;
    public ButtonUserNoVote(Screen screen) {
        initComponents();
        this.screen = screen;
    }
    public ButtonUserNoVote(String user){
        this.user = user;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        User = new javax.swing.JButton();
        userName = new javax.swing.JLabel();

        User.setIcon(new javax.swing.ImageIcon(getClass().getResource("/views/no_vote.png"))); // NOI18N
        User.setMaximumSize(new java.awt.Dimension(100, 100));
        User.setMinimumSize(new java.awt.Dimension(100, 100));
        User.setPreferredSize(new java.awt.Dimension(110, 110));
        User.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                UserMouseClicked(evt);
            }
        });

        userName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        userName.setText(user);
        userName.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(User, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
            .addComponent(userName, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(User, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void UserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_UserMouseClicked
       if(screen!=null)
        screen.setAction("No_vote");
    }//GEN-LAST:event_UserMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton User;
    private javax.swing.JLabel userName;
    // End of variables declaration//GEN-END:variables
}
